package com.zl.feign;

import com.zl.domain.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author zl
 * @date 2023/3/19
 * @apiNote
 */

/**
 * value是服务提供者的应用名称
 */

@FeignClient(value = "order-server")
public interface UserOrderFeign {

    /**
     * 调用服务提供者哪个方法写哪个方法签名(public可不写,interface默认)
     * @return
     */
    @GetMapping("/doOrder")
    public String doOrder();

    @GetMapping("/testUrl/{name}/{age}")
    public String testUrl(@PathVariable("name") String name, @PathVariable("age") Integer age);

    /**
     * required = false 表示可以传一个空的,  为true时即为不能传空
     * @param name
     * @return
     */
    @GetMapping("/oneParam")
    public String oneParam(@RequestParam(required = false) String name);

    @GetMapping("/twoParam")
    public String twoParam(@RequestParam(required = false) String name,@RequestParam(required = false) Integer age);

    @PostMapping("/oneObject")
    public String oneObject(@RequestBody Order order);

    @PostMapping("/oneObjectParam")
    public String oneObjectParam(@RequestBody Order order,@RequestParam(required = false) String name);
}
